

if Effect == nil then
    Effect = {}
    Effect.__index = Effect
end

function Effect:new( o )
    o = o or {}
    setmetatable( o, Effect )
    return o
end


function Effect:PlayLevelUp(caster,color)
    local particle = ParticleManager:CreateParticle(ParticleNames.level_up, PATTACH_ABSORIGIN_FOLLOW, caster)
    caster:EmitSound(SoundsNames.level_up)
    ParticleManager:SetParticleControl(particle, 1, Vector(color[1]/255,color[2]/255,color[3]/255))
    ParticleManager:ReleaseParticleIndex(particle)
end

function Effect:Spawn(caster)
    local particle = ParticleManager:CreateParticle(ParticleNames.spawn, PATTACH_ABSORIGIN_FOLLOW, caster)
    caster:EmitSound(SoundsNames.level_up)
    Timers:CreateTimer(3,function ()
        ParticleManager:DestroyParticle( particle, true )
        ParticleManager:ReleaseParticleIndex(particle)
    end)
end

function Effect:SpawnBoss(caster,cb)

end



--function Effect:Create(particleName, particleAttach, owningEntity,cp, duration)
--    local p = ParticleManager:CreateParticle(particleName, particleAttach, owningEntity)
--    for _,value in pairs(cp) do
--        ParticleManager:SetParticleControl(p, value.point, value.vector)
--    end
--
--    if(duration~=nil and duration > 0) then
--        CreateTimer(function()
--            if(p) then
--                ParticleManager:DestroyParticle(p, false)
--                ParticleManager:ReleaseParticleIndex(p)
--            end
--        end, duration)
--    else
--        ParticleManager:ReleaseParticleIndex(p)
--    end
--
--    return p
--end

function Effect:SetRandomColor(ability,particle)
    if ability.cp60==nil then
        ability.cp60=RandomVector3(255)
        ability.cp61=RandomVector3(255)
        ability.cp62=Vector(RandomFloat(0,1),0,0)
    end
    ParticleManager:SetParticleControl(particle, 60,ability.cp60)
    ParticleManager:SetParticleControl(particle, 61,ability.cp61)
    ParticleManager:SetParticleControl(particle, 62,ability.cp62)
end